home *** CD-ROM | disk | FTP | other *** search
- class classes.shots.DeathLaser
- {
- var x;
- var y;
- var id;
- var dir;
- var eight;
- var clip;
- var axis;
- var type;
- var ep;
- var xMov = 0;
- var yMov = 0;
- var Name = "deathLaser";
- var power = 40;
- var yank = false;
- var c = 0;
- var blastDirArray = ["L","R","U","D","LU","RU","RD","LD"];
- function DeathLaser(px, py, pDir, peight, pid)
- {
- this.x = px;
- this.y = py;
- this.id = pid;
- this.dir = pDir;
- this.eight = peight;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("deathLaser","deathLaser" + this.id + "Clip",_root.d + 1000);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.clip.id = this.id;
- if(this.dir == "U")
- {
- this.axis = "y";
- this.yMov = -15;
- this.xMov = 0;
- this.y += 15;
- }
- else if(this.dir == "D")
- {
- this.axis = "y";
- this.yMov = 15;
- this.xMov = 0;
- this.y -= 15;
- }
- else if(this.dir == "R")
- {
- this.axis = "x";
- this.yMov = 0;
- this.xMov = 15;
- this.x -= 15;
- }
- else
- {
- this.axis = "x";
- this.yMov = 0;
- this.xMov = -15;
- this.x += 15;
- }
- if(this.eight)
- {
- this.type = _root.randRange(1,3);
- }
- else
- {
- this.type = _root.randRange(1,2);
- }
- if(this.type == 2 || this.type == 3)
- {
- this.ep = _root.randRange(10,40);
- this.ep *= 1 / _root.dif.speed;
- }
- else
- {
- this.ep = 100;
- }
- if(this.type == 3)
- {
- this.clip.eight = true;
- }
- this.xMov *= _root.dif.speed;
- this.yMov *= _root.dif.speed;
- this.clip.gotoAndStop(this.dir);
- this.xMov *= _root.randRange2(0.95,1.05);
- this.yMov *= _root.randRange2(0.95,1.05);
- }
- function hit()
- {
- this.yank = true;
- }
- function main()
- {
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
- this.yank = true;
- }
- if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
- {
- this.yank = true;
- }
- this.x += this.xMov;
- this.y += this.yMov;
- this.c = this.c + 1;
- if(this.c >= this.ep)
- {
- this.yank = true;
- if(this.type == 2)
- {
- _root.audio.playLevel3("deathLaserSplit" + (random(3) + 1),_root.randRange(16,21));
- if(this.axis == "x")
- {
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathLaser" + _root.enemyShotID] = new classes.shots.DeathLaser(this.x,this.y,"U",false,_root.enemyShotID);
- _root.addEnemyShot("deathLaser" + _root.enemyShotID);
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathLaser" + _root.enemyShotID] = new classes.shots.DeathLaser(this.x,this.y,"D",false,_root.enemyShotID);
- _root.addEnemyShot("deathLaser" + _root.enemyShotID);
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathNode" + _root.enemyShotID] = new classes.shots.DeathNode(this.x,this.y,_root.enemyShotID);
- _root.addEnemyShot("deathNode" + _root.enemyShotID);
- }
- else
- {
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathLaser" + _root.enemyShotID] = new classes.shots.DeathLaser(this.x,this.y,"R",false,_root.enemyShotID);
- _root.addEnemyShot("deathLaser" + _root.enemyShotID);
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathLaser" + _root.enemyShotID] = new classes.shots.DeathLaser(this.x,this.y,"L",false,_root.enemyShotID);
- _root.addEnemyShot("deathLaser" + _root.enemyShotID);
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathNode" + _root.enemyShotID] = new classes.shots.DeathNode(this.x,this.y,_root.enemyShotID);
- _root.addEnemyShot("deathNode" + _root.enemyShotID);
- }
- }
- else
- {
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathNode" + _root.enemyShotID] = new classes.shots.DeathNode(this.x,this.y,_root.enemyShotID);
- _root.addEnemyShot("deathNode" + _root.enemyShotID);
- var _loc4_ = random(2) != 0 ? false : true;
- if(_loc4_)
- {
- _root.audio.playLevel3("deathLaser8WayRev",_root.randRange(13,17));
- }
- else
- {
- _root.audio.playLevel3("deathLaser8Way",_root.randRange(13,17));
- }
- var _loc3_ = 0;
- while(_loc3_ < 8)
- {
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathBlast" + _root.enemyShotID] = new classes.shots.DeathBlast(this.x,this.y,this.blastDirArray[_loc3_],_loc4_,_root.enemyShotID);
- _root.addEnemyShot("deathBlast" + _root.enemyShotID);
- _loc3_ = _loc3_ + 1;
- }
- }
- }
- if(this.yank)
- {
- _root.removeEnemyShot("deathLaser" + this.id);
- this.yank = false;
- }
- if(random(5) == 0)
- {
- _root.fxID = _root.fxID + 1;
- _root["deathLaserTrail" + _root.fxID] = new classes.fx.DeathLaserTrail(this.x,this.y,this.dir,_root.fxID);
- _root.addFX("deathLaserTrail" + _root.fxID);
- }
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-